    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <style>
        div{
            height: 150px;
            width: 250px;
            border: 1px solid #121ce0;
            background-color: #f52f4c;
            line-height: 150px;
            text-align: center;
            font-size: 50px;
            margin: 10px auto;
        }
        div[class="box2"]{
            background-color: black;
        }
        div[class^="m"]{
            color: #fefefe;
        }
        div[class*="bb"]{
            color: #11fe0d;
        }
        div[class$="8"]{
            color: #fef71f;
        }
    </style>
    <body>
            <div class="abox1">1</div>
            <div class="box2">2</div>
            <div class="box3">3</div>
            <div class="bbox4">4</div>
            <div class="box5">5</div>
            <div class="mbox6">6</div>
            <div class="box7">7</div>
            <div class="box8">8</div>
    </body>

    </html>